length() returns the length of a string.
public static int strlen(String s, String t) {
int length = 2 * s.length() + 3 * t.length();
return length;
}
Function Call | Return Value | |||
---|---|---|---|---|
strlen("ant", "duck") | → | |||
strlen("", "") | → | |||
strlen("", "78") | → | |||
strlen("rock", "sand") | → | |||
strlen("ex", "ball") | → |
Experiment with this code on Gitpod.io